const fs = require('fs');
const path = require('path');

// 确保上传目录存在
const uploadsDir = path.join(__dirname, 'uploads');
const menuImagesDir = path.join(uploadsDir, 'menu-images');

console.log('检查上传目录是否存在...');

if (!fs.existsSync(uploadsDir)) {
  console.log(`创建上传根目录: ${uploadsDir}`);
  fs.mkdirSync(uploadsDir, { recursive: true });
} else {
  console.log(`上传根目录已存在: ${uploadsDir}`);
}

if (!fs.existsSync(menuImagesDir)) {
  console.log(`创建菜单图片目录: ${menuImagesDir}`);
  fs.mkdirSync(menuImagesDir, { recursive: true });
} else {
  console.log(`菜单图片目录已存在: ${menuImagesDir}`);
}

console.log('上传目录检查完成!');